﻿/*************************************************
* Title：TinyToolKit
* Author：Opportunity 
* Describe：滑动选择的页面
* CreateTime：2020-05-19 15:04:17
* Version：1.0
* Modify Recorder：
*************************************************/

using System;
using UnityEngine;
using UnityEngine.EventSystems;

public class ScrollPageItem : MonoBehaviour,IPointerClickHandler
{
    public int pageIndex;

    private ScrollSelect _scrollSelect;

    public void SetScrollSelect(ScrollSelect scrollSelect)
    {
        _scrollSelect = scrollSelect;
    }
    
    public void OnPointerClick(PointerEventData eventData)
    {
        if (Input.touchCount > 1) return;
        
        _scrollSelect.PageTo(pageIndex);
    }
}